var delay_time = 1000;

//App Root
var appPath = getAppPath();

var acquName = ""; // 采集名称
var totalAddr = 0; // 总地址数
var currAddr = 0; // 当前正在采集第几个地址
var totalContent = 0; // 当前地址共有多少条内容

/**
 * 抓取采集进度信息  
 */
function fetchProgressInfo(acquName) {	
	$.ajax({
		url:appPath+'/acqu/progress_info.do',
		success:function(data){
			$('#pgs').show();
			$('#pgs').progressbar('setValue', data["percent"]);
			$("#progressContainer").empty();
			if (data.status > 0) {
				acquName = data["acquName"];
				totalAddr = data["totalAddr"];
				currAddr = data["currAddr"];
				totalContent = data["totalContent"];
				
				$("<p>"+acquName+"共有"+totalAddr+"个地址  正在分析第"+currAddr+"个地址 </p>").appendTo("#progressContainer");
				$("<p>第"+currAddr+"个地址共有"+totalContent+"条内容</p>").appendTo("#progressContainer");							
			} else {
				$("#progressContainer").append("采集完成");
			}
			$("#progressContainer").append("<p>" + data["pgsInfo"] + "</p>");
			setTimeout("fetchProgressInfo('" + acquName + "')", delay_time);
		},
		error:function(XMLHttpRequest, textStatus, errorThrown){
			
		}
	});
}